import logging
import traceback
import unittest

from selenium.webdriver.common.by import By

from Base.Base import Base

#结账管理
class Settle_Page(Base):

    # 点击结算管理
    loc_jiesuan = (By.XPATH, '/html/body/div[1]/div[2]/div[2]/div[2]/div[11]/h2/span')
    # 点击结算记录管理
    loc_jilu = (By.XPATH, '/html/body/div[1]/div[2]/div[2]/div[2]/div[12]/ul/li/div/a')
    # 输入框输入用户名
    loc_shu = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[1]/input')
    # 查询
    loc_cha = (
    By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[1]/form/div/table/tbody/tr/td[2]/div/div/button')
    # 查看
    loc_look = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[10]/div/a')
    # 审核
    loc_shen = (By.LINK_TEXT, '审核')
    # 输入备注
    loc_bei = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[2]/dd/input')
    # 点击提交
    loc_ti = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[1]/div/div/button')
    # 打款
    loc_kuan = (By.LINK_TEXT, '打款')
    # 否
    loc_fou = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[1]/dd/input[2]')
    # 失败
    loc_shibai = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[1]/dd/input[2]')
    # 输入页码
    loc_ye = (By.XPATH, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[3]/div[2]/ul/li[15]/input[1]')
    # 小三角
    loc_go = (By.CLASS_NAME, 'goto')
    #点击取消
    loc_quxiao=(By.XPATH,'/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[2]/div/div/button')

    def jiesuan(self):
        '''
        点击结算管理
        :return:
        '''
        try:
            self.click(self.loc_jiesuan)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def jilu(self):
        '''
        点击结算记录管理
        :return:
        '''
        try:
            self.click(self.loc_jilu)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def shu(self):
        '''
        输入框输入正确用户名
        :return:
        '''
        try:
            self.send_keys(self.loc_shu,'admin')
        except Exception as e:
            logging.info(traceback.format_exc(), e)
    def shu_2(self):
        '''
        输入框输入特殊符号
        :return:
        '''
        try:
            self.send_keys(self.loc_shu,'***')
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def cha(self):
        '''
        点击查询
        :return:
        '''
        try:
            self.click(self.loc_cha)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def look(self):
        '''
        点击查看
        :return:
        '''
        try:
            self.click(self.loc_look)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def shen(self):
        '''
        点击审核
        :return:
        '''
        try:
            self.click(self.loc_shen)
        except Exception as e:
            logging.info(traceback.format_exc(), e)
    def kuan(self):
        '''
        点击打款
        :return:
        '''
        try:
            self.click(self.loc_kuan)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def bei(self):
        '''
        输入备注
        :return:
        '''
        try:
            self.send_keys(self.loc_bei,'完美')
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def ti(self):
        '''
        点击查看
        :return:
        '''
        try:
            self.click(self.loc_ti)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def ye(self):
        '''
        输入页码
        :return:
        '''
        try:
            self.send_keys(self.loc_ye, '100')
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def go(self):
        '''
        点击小三角
        :return:
        '''
        try:
            self.click(self.loc_go)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def fou(self):
        '''
        点击 否
        :return:
        '''
        try:
            self.click(self.loc_fou)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def shibai(self):
        '''
        点击 失败
        :return:
        '''
        try:
            self.click(self.loc_shibai)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

    def quxiao(self):
        '''
        点击 取消
        :return:
        '''
        try:
            self.click(self.loc_quxiao)
        except Exception as e:
            logging.info(traceback.format_exc(), e)

